<template>
  <div class="img-window h100">
    <!-- {{ datas }} -->
    <el-row v-if="datas.arrangement === 1" class="one" justify="space-between">
      <div :style="{ padding: datas.margin + 'px' }">
        <img v-if="datas.list[0].image" class="w100 h100" :src="datas.list[0].image" />
        <img v-else class="w100 h100" src="@/assets/images/empty-banner.png" />
      </div>

      <div :style="{ padding: datas.margin + 'px' }">
        <img v-if="datas.list[1].image" style="width: 100%; height: 100%" :src="datas.list[1].image" />
        <img v-else class="w100 h100" src="@/assets/images/empty-banner.png" />
      </div>
    </el-row>

    <div class="two" v-else-if="datas.arrangement === 2" justify="space-between">
      <div class="left" :style="{ padding: datas.margin + 'px' }">
        <img v-if="datas.list[0].image" style="width: 100%; height: 100%" :src="datas.list[0].image" />
        <img v-else style="width: 100%; height: 100%" src="@/assets/images/empty-banner.png" />
      </div>
      <div class="right">
        <div :style="{ padding: datas.margin + 'px' }">
          <img v-if="datas.list[1].image" style="width: 100%; height: 100%" :src="datas.list[1].image" />
          <img v-else style="width: 100%; height: 100%" src="@/assets/images/empty-banner.png" />
        </div>
        <div :style="{ padding: datas.margin + 'px' }" style="margin-top: 4%">
          <img v-if="datas.list[2].image" style="width: 100%; height: 100%" :src="datas.list[2].image" />
          <img v-else style="width: 100%; height: 100%" src="@/assets/images/empty-banner.png" />
        </div>
      </div>
    </div>

    <el-row class="three" v-else-if="datas.arrangement === 3" justify="space-between">
      <div :style="{ padding: datas.margin + 'px' }" v-for="(item, index) in datas.list" :key="index">
        <img v-if="item.image" class="w100 h100" :src="item.image" />
        <img v-else class="w100 h100" src="@/assets/images/empty-banner.png" />
      </div>
    </el-row>

    <el-row class="four" v-else justify="space-between">
      <div v-for="(item, index) in datas.list" :key="index" :style="{ padding: datas.margin + 'px' }">
        <img v-if="item.image" :src="item.image" />
        <img v-else src="@/assets/images/empty-banner.png" />
      </div>
    </el-row>

    <slot name="deles" />
  </div>
</template>
<script lang="ts" setup name="ImgWindow">
import { toRefs } from "vue";
const props = defineProps({
  datas: {
    type: Object
  }
});
const { datas } = toRefs(props);
</script>

<style lang="scss" scoped>
.img-window {
  padding: 5px;
  overflow: hidden;
}
.one {
  & > div {
    width: 50%;
    height: 185px;
  }
}
.two {
  display: flex;
  justify-content: space-between;
  & > div {
    width: 49%;
    height: 185px;
  }
  .right {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    & > div {
      height: 48%;
    }
  }
}
.three {
  & > div {
    width: 33%;
    height: 125px;
  }
}
.four {
  div {
    box-sizing: border-box;
    width: 50%;
    height: 93px;
    overflow: hidden;
    border-radius: 5px;

    // border: 1px solid #d7d7d7;
    img {
      width: 100%;
      height: 100%;
    }
  }
}
</style>
